<template>
  <div ref="chart" style="width: 100%;" :style="{height: echartsHeight}"></div>
</template>

<script>
import * as Echarts from 'echarts'
require("echarts/lib/component/legend")

export default {
  name: 'echarts',
  props: {
      echartsOptions: {
          type: Object,
          default() {
              return {}
          }
      },
      echartsHeight: {
        type: String
      },
  },
  data() {
    return {
    }
  },
  methods: {
    initEchart() {
      console.log(this.echartsOptions,'--1')
      let chart = Echarts.init(this.$refs.chart);
      chart.clear();
      chart.setOption(this.echartsOptions,true)
    }
  },
  mounted() {
    this.initEchart()
  },
}
</script>

<style scoped>

</style>
  